/*
 * Copyright (c) ycq_work@163.com
 */

package com.mxg.blog.common;

/**
 * @Author: ycq_work@163.com
 * @DATE: 2023/6/27 14:22
 * 返回的错误代码以及错误信息
 */
public class ResultCode {
    /**
     * 返回信息键值
     */
    public static final String code = "code";
    public static final String message = "message";
    public static final String data = "data";

    // 个人信息类
    public static final String id = "id";
    public static final String nickName = "nickName";
    public static final String avatar = "avatar";
    public static final String email = "email";
    public static final String phone = "phone";
    public static final String status = "status";
    public static final String address = "address";
    public static final String alternateAddress = "alternateAddress";
    public static final String startDate = "startDate";
    public static final String endDate = "endDate";
    public static final String harvest = "harvest";
    public static final String ip = "ip";
    public static final String name = "name";


    // 文章分类
    public static final String CategoryName = "CategoryName";
    public static final String update_at = "update_at";
    public static final String tableData = "tableData";

    // 文章信息类
    public static final String title = "title";
    public static final String text = "text";
    public static final String imageUrl = "imageUrl";
    public static final String labelValue = "labelValue";
    public static final String textarea = "textarea";
    public static final String articleImages = "articleImages";
    public static final String articleExcerpt = "articleExcerpt";
    public static final String articleTags = "articleTags";
    public static final String articleCategory = "articleCategory";
    public static final String articleUpdated = "articleUpdated";
    public static final String views = "views";
    public static final String author = "author";
    public static final String hero = "hero";
    public static final String content = "content";


    public static final String description = "description";

    // 文章状态
    public static final String articleCategoryStatus = "articleCategoryStatus";
    public static final Integer statusPublished = 1;
    public static final String published = "已发布";
    public static final Integer statusDraft = 2;
    public static final String draft = "草稿";

    // url
    public static final String url = "url";

    // 图片信息类
    //

    // 文章分类信息类


    /**
     * 错误信息
     * 包括未登录 文章分类, 文章, 图片等
    * */
    // 登录失败后提示
    public static final Integer WRONG_CODE_NOT_LOGIN = 1000;
    public static final String WRONG_MESSAGE_NOT_LOGIN = "请登录后使用";

    // 用户不存在
    public static final Integer WRONG_CODE_WRONG_USER_ACCOUNT = 1005;
    public static final String WRONG_MESSAGE_WRONG_USER_ACCOUNT = "用户名不存在";

    // 验证码错误
    public static final Integer WRONG_CODE_WRONG_CAPTCHA = 1006;
    public static final String WRONG_MESSAGE_WRONG_CAPTCHA = "验证码错误";

    // 密码错误
    public static final Integer WRONG_CODE_WRONG_PASSWORD = 1007;
    public static final String WRONG_MESSAGE_WRONG_PASSWORD = "密码错误";


    /**
     * 文章分类错误
     */
    // 文章分类修改失败
    public static final Integer WRONG_CODE_WRONG_EDIT_CATEGORY = 1010;
    public static final String WRONG_MESSAGE_WRONG_EDIT_CATEGORY = "文章分类修改失败";

    // 文章分类为空
    public static final Integer WRONG_CODE_HAVE_NO_CATEGORIES = 1011;
    public static final String WRONG_MESSAGE_HAVE_NO_CATEGORIES = "文章分类为空";

    /**
     * 文章错误
     */
    // 文章修改失败
    public static final Integer WRONG_CODE_WRONG_EDIT_ARTICLE = 1030;
    public static final String WRONG_MESSAGE_WRONG_EDIT_ARTICLE = "文章修改失败";

    // 文章列表为空
    public static final Integer WRONG_CODE_HAVE_NO_ARTICLES = 1031;
    public static final String WRONG_MESSAGE_HAVE_NO_ARTICLES = "文章列表为空";

    // 未找到该文章
    public static final Integer WRONG_CODE_HAVE_NO_THIS_ARTICLE = 1032;
    public static final String WRONG_MESSAGE_HAVE_NO_THIS_ARTICLE = "未找到该篇文章";

    public static final Integer WRONG_CODE_SAVE_ARTICLE = 1033;
    public static final String WRONG_MESSAGE_SAVE_ARTICLE = "保存文章失败";


    /**
     * 图片出错
     */
    // 未找到该图片

    // 图片格式错误
    public static final Integer WRONG_CODE_FORMATTING_ERROR = 1051;
    public static final String WRONG_MESSAGE_FORMATTING_ERROR = "请选择jpg, jpeg, png格式的图片";

    // 异常报错
    public static final Integer WRONG_CODE_UPLOAD_ERROR = 1060;
    public static final String WRONG_MESSAGE_UPLOAD_ERROR = "上传异常";


    /**
     * 信息获取出错
     */
    // 信息获取出错
    public static final Integer WRONG_CODE_GET_INFORMATION = 1090;
    public static final String WRONG_MESSAGE_GET_INFORMATION = "信息获取失败";

    /**
     * 成功信息
     */
    public static final Integer SUCCESS_CODE = 2000;
    public static final String SUCCESS_MESSAGE = "操作成功";

    public static final String IMAGE_URL = "http://localhost:8081/img/";

    private static volatile ResultCode instance;

    public static ResultCode getInstance(){
        if(instance == null){
            synchronized (ArticleOperate.class){
                if(instance == null){
                    instance = new ResultCode();
                }
            }
        }
        return instance;
    }
}
